package com.example.test_smallwindow;

import android.app.Service;
import android.content.Intent;
import android.nfc.Tag;
import android.os.IBinder;
import android.service.dreams.DreamService;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.LinearLayout;

public class MyService extends DreamService {
    private static final String TAG="MyService";
    private LinearLayout windowView;
    public MyService() {
    }

    @Override
    public void onCreate() {
        Log.e(TAG, "onCreate: " );

        super.onCreate();
    }



    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        Log.e(TAG, "dispatchTouchEvent: ");
        windowView.dispatchTouchEvent(event);
        return super.dispatchTouchEvent(event);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.e(TAG, "onStartCommand: " );
        windowView = ((MyApp) getApplication()).getWindowView();
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        Log.e(TAG, "onDestroy: " );
        super.onDestroy();
    }
}
